<?php
$mesg="发表新留言";
require_once 'validate.php';

session_start();
$uname=$_SESSION['uname'];

if($_POST['submit']){
require_once 'dbconn.php';
$ptitle=$_POST['title'];
$msg=$_POST['msg'];
date_default_timezone_set('PRC');
$ptime=date("Y-n-d H:i:s");
$query= "insert into post(uname,ptitle,msg,ptime) values('$uname','$ptitle','$msg','$ptime');";
$result=$db->sql_query($query);
 if ($result)
        $mesg="发表成功！<a href='msgboard.php'>请点击此处返回留言板!</a>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>发表留言板</title>
<link href="css/twoColFixLtHdr.css" rel="stylesheet" type="text/css" />
</head>
<body class="twoColFixLtHdr">
<div id="logo"></div>
<div id="navi"><table border="0" cellpadding="0" cellspacing="0"><tr>
<?php
require_once 'dbconn.php';
$sql="select * from module";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrowset($result);
require_once 'resource_list.php';
foreach($row as $arr)
{
$modname=$arr['modname'];
$modhref=$arr['modhref'];
navi_list($modname,$modhref);
}
?>
</tr></table>
</div>
<div id="container">
<br /><h1><?php echo $mesg;?></h1>
<hr size="5" color="#9D9D9D" />
<hr size="5" color="#9D9D9D" />
</div>
<div id="container">
<form action="" method="post" name="newpost">
<table width="960" cellpadding="0" cellspacing="0" border="0" id="table">
<tr><th colspan="2" height="40" style="text-align:center;"><?php echo $uname;?>你好！&nbsp;&nbsp;
<input type="button" value="返回留言板" onclick="window.location.reload('msgboard.php');" /></th></tr>
<tr><td height="50" width="200" style="text-align:right">标题：</td>
<td style="text-align:left;"><input type="text" size="60" name="title"/></td></tr>
<tr><td width="200" style="text-align:right">内容：</td>
<td rowspan="2" style="text-align:left;"><textarea name="msg" cols="60" rows="20"></textarea></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td height="50">&nbsp;</td><td style="text-align:center"><input type="submit" name="submit" value="发表" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" name="cancel" value="取消" onclick="window.location.reload('msg_newpost.php');"/></td></tr>
<tr><th colspan="2" height="50">&nbsp;</th></table></form>
</div>
<div id="footer">
<p>Copyright © 2010 IBM club,Shenzhen University, All Rights Reserved.</p></div>
</div>
</body>
</html>
